# homework：
# 1. 尝试用户输入学生一周的课表信息，尝试用 占位符、2种format打印学生信息（可设计）
# 2. 用户输入查询日期和时间，可返回对应的课表信息；用户查询当前时间，可返回当前课表信息
# 3. Python内置数据结构 列表 切片、方法练习
# 4. 完成课本练习
#
# 思考题：
# names = [.....]
# 想找出重名的名字 ------> rename = [..]？
#
# 循环遍历每一个元素---->[]
# 如果遍历到某一个前面出现过，存到一个[]
# 计算重名个数？ '''
#
# 「列表训练营」
# 1. 输入一行字符，分别统计出其中英文字母、空格、数字和其它字符的个数。
# 2. 班上投票竞选，将选择票数最高的同学担任班长，请你设计一个投票系统，输入名字即可投票，最后统计大家的得票数，公开投票结果，并宣布谁担任班长。

# 1.用户输入学生一周的课表信息
# （1）占位符
name = input("姓名:")
week = input("星期:")
first_class = input("1-2节（8：00~9：30）:")
second_class = input("3-5节（9：45~12：00）:")
third_class = input("6-7节（12：50~14：20）:")
forth_class = input("8-9节（14：30~15：55）:")
fifth_class = input("10-11节（16：10~17：35）:")
sixth_class = input("12-13节（18：45~20：10）:")
seventh_class = input("14-15节（20：15~21：45）:")
greeting = input("每日宣言：")

info01 = '''
--------------------------%s的今日课程表-----------------------------
                            |星期%s|
-------------------------------------------------------------------
          |1-2节（8：00~9：30）:%s|
          |3-5节（9：45~12：00）:%s|
          |6-7节（12：50~14：20）:%s|
          |8-9节（14：30~15：55）:%s|
          |10-11节（16：10~17：35）:%s|
          |12-13节（18：45~20：10）:%s|
          |14-15节（20：15~21：45）:%s|
-------------------------------------------------------------------
|每日宣言：%s|
-------------------------------------------------------------------

''' % (name,week,first_class,second_class,third_class,forth_class,fifth_class,sixth_class,seventh_class,greeting)

print(info01)

#（2）第一种format

info02 = '''
--------------------------{姓名}的今日课程表-----------------------------
                            |星期{星期}|
-------------------------------------------------------------------
          |1-2节（8：00~9：30）:{第1节}|
          |3-5节（9：45~12：00）:{第2节}|
          |6-7节（12：50~14：20）:{第3节}|
          |8-9节（14：30~15：55）:{第4节}|
          |10-11节（16：10~17：35）:{第5节}|
          |12-13节（18：45~20：10）:{第6节}|
          |14-15节（20：15~21：45）:{第7节}|
-------------------------------------------------------------------
|每日宣言：{宣言}|
-------------------------------------------------------------------
'''.format(姓名=name,星期=week,第1节=first_class,第2节=second_class,第3节=third_class,第4节=forth_class,第5节=fifth_class,第6节=sixth_class,第7节=seventh_class,宣言=greeting)

print(info02)

#（2）第2种format

info03 = '''
--------------------------{0}的今日课程表-----------------------------
                            |星期{1}|
-------------------------------------------------------------------
          |1-2节（8：00~9：30）:{2}|
          |3-5节（9：45~12：00）:{3}|
          |6-7节（12：50~14：20）:{4}|
          |8-9节（14：30~15：55）:{5}|
          |10-11节（16：10~17：35）:{6}|
          |12-13节（18：45~20：10）:{7}|
          |14-15节（20：15~21：45）:{8}|
-------------------------------------------------------------------
|每日宣言：{9}|
-------------------------------------------------------------------
'''.format(name,week,first_class,second_class,third_class,forth_class,fifth_class,sixth_class,seventh_class,greeting)

print(info03)

#2.用户输入查询日期和时间，可返回对应的课表信息；用户查询当前时间，可返回当前课表信息
import datetime
import time
d = datetime.date.today()
week_day = time.strftime("%A")

name = input("姓名:")
week = input("星期:")
now = input("时间:")#查询的时间
judge_day = input("是否查询今日的课表信息：")
judge_current = input("是否查询当前时间的课表信息：")
time_now = time.strftime("%H:%M")#当前时间


info04 = '''
-----------{姓名}的今日课程表------------
'''.format(姓名=name)

print(info04)

if week in "一":
    print("今日课表")
    print("今日无课")
elif week in "二":
    print("今日课表")
    print("[12:50~14:20]生活中的投资理财")
    print("[14:30~15:55]体育—足球课")
    print("[19:30~21:45]国际贸易案例精选——以欺诈与风险防范为主线")
elif week in "三":
    print("今日课表")
    print("[08:00~09:30]毛概实践课")
    print("[12:50~14:20]大学英语")
    print("[18:45~20:55]Python语言")
elif week in "四":
    print("今日课表")
    print("[09:45~12:00]毛概课")
    print("[14:30~16:55]网站运营与管理")
    print("[18:45~20:55]API、机器学习与人工智能")
elif week in "五":
    print("今日课表")
    print("[08:00~09:30]大学英语")
    print("[9:45~12:00]商品包装与广告设计")
else:
    print("今日课表")
    print("今日无课")

if week in "Monday" and "0:00" <= now < "17:00":
    print("目前状态：今天没课，但是下午有用户界面设计，有时间可以叫上咏琳去旁听哦")
elif week in "Monday" and "17:00" <= now < "21:00":
    print("目前状态：今天晚上有大一赵蔓老师的网址设计课，可以去复习一下，就是不知道还有没有座位")
elif week in "Monday" and "21:00" <= now < "23:59":
    print("目前状态：休息一下吧")
elif week in "Tuesday" and "0:00" <= now < "12:00":
    print("目前状态：今天上午没课，可以做自己想做的事情啦")
elif week in "Tuesday" and "12:00" <= now < "12:50":
    print("目前状态：准备上生活中的投资理财啦")
elif week in "Tuesday" and "12:50" <= now < "14:20":
    print("目前状态：生活中的投资理财")
elif week in "Tuesday" and "14:20" <= now < "14:30":
    print("目前状态：准备上足球课啦")
elif week in "Tuesday" and "14:30" <= now < "15:55":
    print("目前状态：足球课")
elif week in "Tuesday" and "15:55" <= now < "18:45":
    print("目前状态：准备上国际贸易案例精选啦")
elif week in "Tuesday" and "19:30" <= now < "21:45":
    print("目前状态：国际贸易案例精选")
elif week in "Tuesday" and "20:10" <= now < "23:59":
    print("目前状态：休息一下吧")
elif week in "Wednesday" and "08:00" <= now < "09:30":
    print("目前状态：毛概实践课")
elif week in "Wednesday" and "09:30" <= now < "12:50":
    print("目前状态：准备上中午的大英课啦")
elif week in "Wednesday" and "12:50" <= now < "14:20":
    print("目前状态：大学英语课")
elif week in "Wednesday" and "14:20" <= now < "18:45":
    print("目前状态：准备上晚上的python课啦")
elif week in "Wednesday" and "18:45" <= now < "20:55":
    print("目前状态：python语言课")
elif week in "Wednesday" and "20:55" <= now < "23:59":
    print("目前状态：休息一下吧")
elif week in "Thursday" and "00:00" <= now < "09:45":
    print("目前状态：准备上毛概课啦")
elif week in "Thursday" and "09:45" <= now < "12:00":
    print("目前状态：毛概课")
elif week in "Thursday" and "12:00" <= now < "14:20":
    print("目前状态：准备上网站运营与管理课啦")
elif week in "Thursday" and "14:20" <= now < "16:50":
    print("目前状态：网站运营与管理课")
elif week in "Thursday" and "16:50" <= now < "18:45":
    print("目前状态：准备上API、机器学习与人工智能课啦")
elif week in "Thursday" and "18:45" <= now < "20:55":
    print("目前状态：API、机器学习与人工智能课")
elif week in "Thursday" and "20:55" <= now < "23:59":
    print("目前状态：休息一下吧")
elif week in "Friday" and "00:00" <= now < "08:00":
    print("目前状态：准备上大英课啦")
elif week in "Friday" and "08:00" <= now < "09:30":
    print("目前状态：大学英语课")
elif week in "Friday" and "9:30" <= now < "9:45":
    print("现在状态：准备上商品包装和广告设计")
elif week in "Friday" and "9:45" <= now < "12:00":
    print("现在状态：商品包装和广告设计")
else:
    print("目前状态：现在没课哦，可以做自己想做的事情啦")


print("------------------------------------")

if judge_day in "是":
    if week_day in "Monday":
        print("今日课表")
        print("今日无课")
    elif week_day in "Tuesday":
        print("今日课表")
        print("[12:50~14:20]生活中的投资理财")
        print("[14:30~15:55]体育—足球课")
        print("[19:30~21:45]国际贸易案例精选")
    elif week_day in "Wednesday":
        print("今日课表")
        print("[08:00~09:30]毛概实践课")
        print("[12:50~14:20]大学英语")
        print("[18:45~20:55]Python语言")
    elif week_day in "Thursday":
        print("今日课表")
        print("[09:45~12:00]毛概课")
        print("[14:30~16:55]网站运营与管理")
        print("[18:45~20:55]API、机器学习与人工智能")
    elif week_day in "Friday":
        print("今日课表")
        print("[08:00~09:30]大学英语")
        print("[9:45~12:00]商品包装与广告设计")
    else:
        print("今日课表")
        print("今日无课")
else:
    print("")

print("------------------------------------")
if judge_current in "是":
    print("当前时间：",time_now)
    if week in "Monday" and "0:00" <= now < "17:00":
        print("目前状态：今天没课，但是下午有用户界面设计，有时间可以叫上咏琳去旁听哦")
    elif week in "Monday" and "17:00" <= now < "21:00":
        print("目前状态：今天晚上有大一赵蔓老师的网址设计课，可以去复习一下，就是不知道还有没有座位")
    elif week in "Monday" and "21:00" <= now < "23:59":
        print("目前状态：休息一下吧")
    elif week in "Tuesday" and "0:00" <= now < "12:00":
        print("目前状态：今天上午没课，可以做自己想做的事情啦")
    elif week in "Tuesday" and "12:00" <= now < "12:50":
        print("目前状态：准备上生活中的投资理财啦")
    elif week in "Tuesday" and "12:50" <= now < "14:20":
        print("目前状态：生活中的投资理财")
    elif week in "Tuesday" and "14:20" <= now < "14:30":
        print("目前状态：准备上足球课啦")
    elif week in "Tuesday" and "14:30" <= now < "15:55":
        print("目前状态：足球课")
    elif week in "Tuesday" and "15:55" <= now < "18:45":
        print("目前状态：准备上国际贸易案例精选啦")
    elif week in "Tuesday" and "19:30" <= now < "21:45":
        print("目前状态：国际贸易案例精选")
    elif week in "Tuesday" and "20:10" <= now < "23:59":
        print("目前状态：休息一下吧")
    elif week in "Wednesday" and "08:00" <= now < "09:30":
        print("目前状态：毛概实践课")
    elif week in "Wednesday" and "09:30" <= now < "12:50":
        print("目前状态：准备上中午的大英课啦")
    elif week in "Wednesday" and "12:50" <= now < "14:20":
        print("目前状态：大学英语课")
    elif week in "Wednesday" and "14:20" <= now < "18:45":
        print("目前状态：准备上晚上的python课啦")
    elif week in "Wednesday" and "18:45" <= now < "20:55":
        print("目前状态：python语言课")
    elif week in "Wednesday" and "20:55" <= now < "23:59":
        print("目前状态：休息一下吧")
    elif week in "Thursday" and "00:00" <= now < "09:45":
        print("目前状态：准备上毛概课啦")
    elif week in "Thursday" and "09:45" <= now < "12:00":
        print("目前状态：毛概课")
    elif week in "Thursday" and "12:00" <= now < "14:20":
        print("目前状态：准备上网站运营与管理课啦")
    elif week in "Thursday" and "14:20" <= now < "16:50":
        print("目前状态：网站运营与管理课")
    elif week in "Thursday" and "16:50" <= now < "18:45":
        print("目前状态：准备上API、机器学习与人工智能课啦")
    elif week in "Thursday" and "18:45" <= now < "20:55":
        print("目前状态：API、机器学习与人工智能课")
    elif week in "Thursday" and "20:55" <= now < "23:59":
        print("目前状态：休息一下吧")
    elif week in "Friday" and "00:00" <= now < "08:00":
        print("目前状态：准备上大英课啦")
    elif week in "Friday" and "08:00" <= now < "09:30":
        print("目前状态：大学英语课")
    elif week in "Friday" and "9:30" <= now < "9:45":
        print("现在状态：准备上商品包装和广告设计")
    elif week in "Friday" and "9:45" <= now < "12:00":
        print("现在状态：商品包装和广告设计")
    else:
        print("目前状态：现在没课哦，可以做自己想做的事情啦")
else:
    print("")

print("------------------------------------")

# have a try(不成熟）

print("_"*175)
print("{:^25}|{:^25}|{:^25}|{:^25}|{:^25}|{:^25}|".format("时间","星期一","星期二","星期三","星期四","星期五"))
print("_"*175)

print("{:^24}|{:^27}|{:^27}|{:^25}|{:^27}|{:^24}|"
      .format("第一节","","","毛概实践","","大学英语"))
print("{:^26}|{:^27}|{:^27}|{:^25}|{:^27}|{:^25}|".format("8:00~8:40","","","(李小红)","","(王金妮)"))

print("_"*175)
print("{:^24}|{:^27}|{:^27}|{:^25}|{:^27}|{:^24}|"
      .format("第二节","","","毛概实践","","大学英语"))
print("{:^26}|{:^27}|{:^27}|{:^25}|{:^27}|{:^25}|".format("8:00~8:40","","","(李小红)","","(王金妮)"))

print("_"*175)
print("{:^24}|{:^27}|{:^27}|{:^27}|{:^26}|{:^26}|"
      .format("第三节","","","","毛概","商品包装"))
print("{:^26}|{:^27}|{:^27}|{:^27}|{:^25}|{:^27}|".format("9:45~10:25","","","","(张由菊)","(张莹莹)"))

print("_"*175)
print("{:^24}|{:^27}|{:^27}|{:^27}|{:^26}|{:^26}|"
      .format("第四节","","","","毛概","商品包装"))
print("{:^26}|{:^27}|{:^27}|{:^27}|{:^25}|{:^27}|".format("10:35~11:15","","","","(张由菊)","(张莹莹)"))

print("_"*175)
print("{:^24}|{:^27}|{:^27}|{:^27}|{:^26}|{:^26}|"
      .format("第五节","","","","毛概","商品包装"))
print("{:^26}|{:^27}|{:^27}|{:^27}|{:^25}|{:^27}|".format("11:20~12:00","","","","(张由菊)","(张莹莹)"))

print("_"*175)
print("{:^24}|{:^27}|{:^25}|{:^24}|{:^27}|{:^29}|"
      .format("第六节","","投资理财","大学英语","",""))
print("{:^26}|{:^27}|{:^26}|{:^25}|{:^27}|{:^29}|".format("12:50~13:30","","(潘露)","(王金妮)","",""))

print("_"*175)
print("{:^24}|{:^27}|{:^25}|{:^24}|{:^27}|{:^29}|"
      .format("第七节","","投资理财","大学英语","",""))
print("{:^26}|{:^27}|{:^26}|{:^25}|{:^27}|{:^29}|".format("13:40~14:20","","(潘露)","(王金妮)","",""))

print("_"*175)
print("{:^24}|{:^27}|{:^27}|{:^26}|{:^25}|{:^28}|"
      .format("第八节","","足球","","网址运营",""))
print("{:^26}|{:^27}|{:^26}|{:^26}|{:^26}|{:^28}|".format("14:30~15:10","","(贾帅玲)","","(胡美香)",""))

print("_"*175)
print("{:^24}|{:^27}|{:^27}|{:^26}|{:^25}|{:^28}|"
      .format("第九节","","足球","","网址运营",""))
print("{:^26}|{:^27}|{:^26}|{:^26}|{:^26}|{:^28}|".format("15:15~15:55","","(贾帅玲)","","(胡美香)",""))

print("_"*175)
print("{:^24}|{:^27}|{:^28}|{:^26}|{:^26}|{:^28}|"
      .format("第十节","","","","网址运营",""))
print("{:^26}|{:^27}|{:^28}|{:^26}|{:^26}|{:^28}|".format("16:10~16:50","","","","(胡美香)",""))

print("_"*175)
print("{:^24}|{:^27}|{:^28}|{:^26}|{:^28}|{:^29}|"
      .format("第十一","","","","",""))
print("{:^26}|{:^27}|{:^28}|{:^26}|{:^28}|{:^29}|".format("16:55~17:35","","","","",""))

print("_"*175)
print("{:^24}|{:^27}|{:^28}|{:^26}|{:^28}|{:^29}|"
      .format("第十二","","","python","API",""))
print("{:^26}|{:^27}|{:^28}|{:^24}|{:^26}|{:^29}|".format("18:45~19:25","","","(许智超)","(许智超)",""))

print("_"*175)
print("{:^24}|{:^27}|{:^25}|{:^26}|{:^27}|{:^29}|"
      .format("第十三","","国际贸易案例","python","API",""))
print("{:^26}|{:^27}|{:^27}|{:^24}|{:^25}|{:^29}|".format("19:30~20:10","","(伍雁南)","(许智超)","(许智超)",""))

print("_"*175)
print("{:^24}|{:^27}|{:^25}|{:^26}|{:^27}|{:^29}|"
      .format("第十四","","国际贸易案例","python","API",""))
print("{:^26}|{:^27}|{:^27}|{:^24}|{:^25}|{:^29}|".format("20:15~20:55","","(伍雁南)","(许智超)","(许智超)",""))

print("_"*175)
print("{:^24}|{:^27}|{:^25}|{:^27}|{:^26}|{:^29}|"
      .format("第十五","","国际贸易案例","","",""))
print("{:^26}|{:^27}|{:^27}|{:^27}|{:^26}|{:^29}|".format("20:15~20:55","","(伍雁南)","","",""))

# 3. Python内置数据结构 列表 切片、方法练习
#1、列表 假设 存晚上班同学的信息  ---- 变量
# ** 正则表达式 处理字符串

names = "Irene Vicky Cc"
print(names)
# 列表 list
names = ["Irene Vicky Cc"]
print(names)

# 列表性质：有序、可变
# 列表的方式（方法/函数）

# 1、增加 append 增加在列表末尾 insert 增加 x，插入就是第x位
names.append("xiaobai")
print(names)

names.append("xiaohei")
print(names)

names.insert(2,"xiaohuang xiaohe")
print(names)

# 2、删除 pop a\什么都不填，删除末位 ,b\删除指定位置的列表内容
names.pop()
print(names)

names.pop(2)
print(names)

pop_names = names.pop(2) #被删除的内容
print(pop_names)
print(names)

# remove 可以指定内容
names.remove("xiaobai")
print(names)

# 3、修改 我需要清楚知道他的位置
names[0] = "xiaoxi"
print(names)

_names = "xiaoxi"
if _name in names:
    names.remove(_name)

#4、查 -----> 改或者其他操作
# 适合我不知道位置的修改方法
# 查，有没有？
_names = "Irene"
if _names in names:
    print(names.index(_names)) #index 反馈回在不在，在的位置 1
   names[2] ="xiaot" 改
   names.pop(1) 删
# 如果存在我们的列表中，我们可以做一些操作，例如删除、改
else:
    print("%s 不在我们的列表中" %(_names))
print(names)

# 4、查 （列表的切片）
print(names[2])

# 切片

names = ["a","b","d","e","f","g"]
print(names[1],names[2])

# 切片 仍是一个列表 回顾 range（1，3）末位
print(names[1:2])

print(names[1:3])

# 如何从列表首位开始，可以省略0
print(names[0:3])
print(names[:3])

# 从末位开始取 从小到大开始写
print(names[-1])
print(names[-2:-1])
print(names[-3:-1])
print(names[-3:])

names.clear()
print(names)

# 自学sort/ascii

names.count()
a = [1,2,3,4,3,2,1]
print(a)
print(a.count(2))
print(a.count(4))

# 思考题：
# names = [.....]
# 想找出重名的名字 ------> rename = [..]？
# 循环遍历每一个元素---->[]
# 如果遍历到某一个前面出现过，存到一个[]
# 计算重名个数？ 

names = ["A","B","C","D","1","2","3","4","a","b","c","d","一"]
rename = []
a = []
from collections import Counter
result = Counter(names)
print(result)
for i in names:
  if names.count(i)>1:
      if i not in rename:
          rename.append(i)
          print(rename)

if rename == a:
    print("没有重复的名字出现")
# print(result)

# [列表训练营]
# 1. 输入一行字符，分别统计出其中英文字母、空格、数字和其它字符的个数。
# 2. 班上投票竞选，将选择票数最高的同学担任班长，请你设计一个投票系统，输入名字即可投票，最后统计大家的得票数，公开投票结果，并宣布谁担任班长。

# 字符串
# 一、
s =input('请输入字符串：')
dic = {'letter': 0, 'integer': 0, 'space': 0, 'other': 0}
for i in s:
    if i > 'a' and i < 'z' or i > 'A' and i < 'Z':
        dic['letter'] += 1
    elif i in '0123456789':
        dic['integer'] += 1
    elif i == ' ':
        dic['space'] += 1
    else:
        dic['other'] += 1

print('统计字符串：', s)
print(dic)
print('------------显示结果2---------------')
for i in dic:
    print('%s=' % i, dic[i])
print('------------显示结果3---------------')
for key, value in dic.items():
    print('%s=' % key, value)

# 二、
tmpStr = input('请输入字符串：')
alphaNum=0
numbers=0
spaceNum=0
otherNum=0
for i in tmpStr:
    if i.isalpha():
        alphaNum +=1
    elif i.isnumeric():
        numbers +=1
    elif i.isspace():
        spaceNum +=1
    else:
        otherNum +=1
print('字母=%d'%alphaNum)
print('数字=%d'%numbers)
print('空格=%d'%spaceNum)
print('其他=%d'%otherNum)

# 三、
InPut = input('请输入字符串：')
letters  = [ ]
spaces = [ ]
digits   = [ ]
others = [ ]
for i in iter(InPut):
    if i.isalpha():
        letters.append(i)
    elif i.isspace():
        spaces.append(i)
    elif i.isdigit():
        digits.append(i)
    else:
        others.append(i)
print('''
字母: {}, 个数: {}
空格: {}, 个数: {}
数字: {}, 个数: {}
其他: {}, 个数: {}'''\
.format(letters, len(letters), spaces, len(spaces), digits, len(digits),others, len(others)))

#班上投票竞选，将选择票数最高的同学担任班长，请你设计一个投票系统，输入名字即可投票，最后统计大家的得票数，公开投票结果，并宣布谁担任班长。（不断试错）
# import random
#
# import xlrd
# from selenium import webdriver
# from selenium.webdriver.common.keys import Keys
# import time
#
# def vote(username, work_num, iphone_no, list1, list2, list3, list4, driver):
# driver = webdriver.Firefox()

# if not count:
# driver.get(“https://*******/Survey2/?id=61”)
# stop_time = 0.1
# stop_time1 = 2
# refresh_time = 1
# time.sleep(stop_time1)
# 姓名
# driver.find_element_by_id(“userName”).send_keys(“张伟”)
# driver.find_element_by_id('userName').send_keys("{}".format(username))
# time.sleep(stop_time)
# 工号
# driver.find_element_by_id("workerNum").send_keys("{}".format(work_num))
# time.sleep(stop_time)
# 手机号
# driver.find_element_by_id("phoneNum").send_keys("{}".format(iphone_no))
# time.sleep(stop_time)

#投票系统
names = []
for i in range(10):
    print("----------------投票竞选系统--------------------")
    _names = input("输入你想投票的同学名字：")
    print(_names)
    names.append(_names)
    from collections import Counter
    result = Counter(names)
    print(result)
    print("------------------投票结束----------------------")
# vote = {}
#  def vote_system(n):
#      if vote.get(n) is True:
#          return "Don't vote again!"
#      else:
#          vote[n] = True
#          return "Thanks for voting"
